<template>
  <component :is="echartsType" :charts="charts" :expand="expand" :title="title"> </component>
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue'

export default defineComponent({
  name: 'VanEcharts',
  props: {
    type: {
      type: String,
      default: 'line'
    },
    title: {
      type: String,
      default: ''
    },
    charts: {
      type: Object,
      default: () => {
        return {}
      }
    },
    expand: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  setup(props) {
    const echartsType = computed(() => {
      return 'VanEcharts' + props.type.substring(0, 1).toUpperCase() + props.type.substring(1)
    })
    return {
      echartsType
    }
  }
})
</script>
